﻿


Public Class _Default
    Inherits System.Web.UI.Page

    Private Sub cmdLogin_Click(sender As Object, e As System.EventArgs) Handles cmdLogin.Click

        Try

            If modShared.UserLogin(txtEmail.Text, txtPassword.Text, mdMessageDisplayLogin) Then

                Response.Redirect("Dashboard.aspx")

            End If

        Catch ex As Exception

            mdMessageDisplayLogin.AddMessage(ex.Message)

        End Try

    End Sub

    Private Sub cmdRegister_Click(sender As Object, e As System.EventArgs) Handles cmdRegister.Click

        Dim bolSave As Boolean = True

        Try

            'Validate Controls
            If txtRegisterEmail.Text.Trim = "" Then

                bolSave = False

                mdMessageDisplayRegister.AddMessage("Email is required")

            End If

            If txtRegisterPassword.Text.Trim = "" Then

                bolSave = False

                mdMessageDisplayRegister.AddMessage("Password is required.")

            Else

                If txtRegisterPassword.Text.Trim <> txtRegisterPasswordConfirm.Text.Trim Then

                    bolSave = False

                    mdMessageDisplayRegister.AddMessage("Passwords must match.")

                End If

            End If

            If bolSave Then

                If modShared.UserRegister(txtRegisterEmail.Text, txtRegisterPassword.Text, mdMessageDisplayRegister) Then

                    Response.Redirect("PlayerSettings.aspx")

                End If

            End If

        Catch ex As Exception

            mdMessageDisplayRegister.AddMessage(ex.Message)

        End Try

    End Sub

End Class